package test.redis;

import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

public class test {
	//****************单例一个连接池***************  
    private static JedisPool jedispool = null; 
	 /**         
     * 获取连接池         
     * @return 数据源         
     */       
    public static JedisPool get_jedispool() {  
        if(jedispool == null){  
            JedisPoolConfig jedispool_config = new JedisPoolConfig();  
            jedispool_config.maxActive =  20;  
            jedispool_config.maxIdle = 0;  
            jedispool_config.maxWait = 1000;  
            jedispool_config.testOnBorrow = true;  
            jedispool = new JedisPool(jedispool_config, "localhost", 6379);  
        }  
        return jedispool;       
    }  
	
	
	public static void main(String[] args){
		DBRedis dbr = new DBRedis();
		int id = 1;
		dbr.lpush("test1", String.valueOf(id));
		
		String res = dbr.rpop("test1");
		System.out.println(res);
	}
	

}
